package cn.bo.cloud.common.core.utils.net;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.net.InetAddress;

/**
 * 检测ip port 是否通畅
 * @author jb.zhou
 */
public class HostUtils {
    private final static Logger logger = LoggerFactory.getLogger(HostUtils.class);

    public static boolean isHostReachable(String host, Integer timeOut) {
        try {
            return InetAddress.getByName(host).isReachable(timeOut);
        } catch (IOException e) {
            logger.error("ip通达性检测异常,{}", e);
        }
        return false;
    }


}
